package com.hex.ds.hdrs.period.job.controller;

import com.hex.bigdata.hbda.annotation.Log;
import com.hex.ds.hdrs.period.job.po.HisBitch;
import com.hex.ds.hdrs.period.job.service.BackUpDataService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Slf4j
@RestController
@RequestMapping("/api/backUp")
public class BackUpController {

    @Autowired
    private BackUpDataService backUpDataService;

    /**
     * @Method: dataBackup <br>
     * @Param: [hisBitch] <br>
     * @Return: org.springframework.http.ResponseEntity<java.lang.Object> <br>
     * @Description：数据备份接口<br>
     * @Author： gc.zuo<br>
     * @Date： 2021/6/3 15:30 <br>
     * @Version： V1.0<br>
     */
    @PostMapping("/backUpData")
    @Log("数据备份")
    @ApiOperation("数据备份")
    public ResponseEntity<Object> dataBackup(@RequestBody HisBitch hisBitch) {
        log.debug("【BackUpController.dataBackup】参数备份日期: {}", hisBitch.getDateTs());
        this.backUpDataService.backUpData(hisBitch);
        return new ResponseEntity<>("数据备份成功！", HttpStatus.OK);
    }
}
